package thss.lau.secretshare;

import java.math.BigInteger;
import java.util.List;

public class Info {
	private int x;
	private BigInteger val;
	private BigInteger b;

	public int getX() {
		return x;
	}

	public void setX(int x) {
		this.x = x;
	}

	public BigInteger getVal() {
		return val;
	}

	public void setVal(BigInteger val) {
		this.val = val;
	}

	public Info(int x, BigInteger val) {
		this.x = x;
		this.val = val;
	}

	public BigInteger getB() {
		return b;
	}

	public void setB(List<Info> infos, BigInteger p) {
		this.b = new BigInteger("1");
		for (Info info : infos) {
			if (this.equals(info)) {
				continue;
			}
			b = b.multiply(BigInteger.valueOf(info.getX()).multiply(
					BigInteger.valueOf((info.getX() - x)).modInverse(p)));

		}

		b = b.mod(p);
	}
}
